|
|
|
| TABLE 15.5. CONSTANTS FOR THEEffectsARGUMENT. | | Constant | Value | Description | | vbDropEffectNone | 0 | Drop target cannot accept the data. | | vbDropEffectCopy | 1 | Drop results in a copy. The original data is untouched by the drag source. | | vbDropEffectMove | 2 | Drag source removes the data. | | vbDropEffectScroll | &H80000000& | Scrolling is about to start or is currently occurring in the target. |
|
|
|
|
|
|
The state argument enables you to respond to the source data entering, passing over, and leaving the target control. As an example, when the source data is dragged onto the target control, the state argument is set to vbEnter. The constants listed in Table 15.6 are used to check the value of the state argument. |
|
|
|
|
| TABLE 15.6. CONSTANTS USED TO CHECK THE STATE ARGUMENT. | | Constant | Value | Description | | vbEnter | 0 | Data was dragged within the range of a target. | | vbLeave | 1 | Data was dragged out of the range of a target. | | vbOver | 2 | Data is still within the range of a target, and either the mouse has moved, a mouse or keyboard button has changed, or a certain system-determined amount of time has elapsed. |
|
|
|
|
|
|
The code in Listing 15.3 checks the format of the data being dragged over a control and if it is compatible and the data is dropped, a move operation is requested. However, if the data isn't compatible, the effect argument is set to None and a No Drop mouse pointer is displayed. |
|
|
|
|
|
|
|
|
LISTING 15.3 DRAGOVER.TXTCHECKING THE DATA FORMAT AND SETTING THE OPERATIONS ALLOWED. |
|
|
|
 |
|
|
|
|
1: Private Sub txtTarget_OLEDragOver(Data As VB.DataObject, Effect As Long,_
2: Button As _
3: Integer, Shift As Integer, X As Single, Y As Single, State As Integer)
4: If Data.GetFormat(vbCFText) Then
5: Effect = vbDropEffectMove And Effect
6: Else
7: Effect = vbDropEffectNone
8: End If
9: End Sub |
|
|
|
|
|